package com.suotuo.module.sys.dao;

import com.suotuo.module.sys.entity.Games;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author liulubingjava@163.com
 * @date 2019/1/18 15:03
 */
@Repository
public interface GameDAO extends JpaRepository<Games,String> {

    @Query(value = "select * from games g,game_category gc where g.game_id = gc.game_id and gc.category_id = ?1",nativeQuery = true)
    Page<Games> findByCategoryId(String categoryId,Pageable pageable);
    @Query(value = "SELECT game_id from games ORDER BY creat_time desc LIMIT 1 ",nativeQuery = true)
    String getMaxId();
}
